1. Field of the Invention
The present invention relates to an apparatus and a method for processing MIDI data, and more particularly, to an apparatus and a method for processing MIDI data which are capable of outputting rich sound quality with few system resources by controlling a volume of sound sources before converting the sound sources to a frequency.
2. Description of the Related Art
A wireless terminal is an apparatus for performing communication or transmitting/receiving data while moving. For example, the wireless terminal may be a cellular phone or a personal digital assistant (PDA).
Musical instrument digital interface (MIDI) is a standard protocol enabling data communication between electronic musical instruments. The MIDI is a standard specification for hardware and data structure that provide compatibility for the input/output between musical instruments or between musical instruments and computers through digital interface. Accordingly, devices having the MIDI can share data with each other because compatible data are created therein.
A MIDI file contains information such as intensity and tempo of a note, command language related to musical characteristics, and a type of a musical instrument as well as an actual musical score. However, unlike a wave file, a MIDI file does not store waveform information, the file size of the MIDI file is relatively small, and it is easy to edit the MIDI file (for example, adding or deleting an instrument).
In the early days, an artificial sound was produced by using a frequency modulation (FM) method to reproduce a sound of a musical instrument. The FM method has an advantage of using a small amount of memory since no separate sound source is used when reproducing the sound of the musical instrument. However, the FM method has a disadvantage of not being able to reproduce a natural sound close to an original sound.
As the price of memory has fallen, a method has been developed for producing and storing individual sound sources for each musical instrument and each of its notes in a memory, and producing sound by changing frequencies and vibrations while maintaining the instrument's unique waveform. This method uses a wave-table, in which the above-mentioned sound source samples are stored, and is widely used because it is capable of producing a natural sound closer to the original sound.
FIG. 1 is a schematic view illustrating construction of a MIDI player in the related art.
As illustrated in FIG. 1, the MIDI player includes: a MIDI parser 110 for extracting a plurality of notes and note playback duration information from a MIDI file; a MIDI sequencer 120 for sequentially outputting the extracted note playback duration; a wave table 130 for recording at least one sound source sample; an envelope generator 140 for generating an envelope which determines levels of a volume and a pitch; and a frequency converter 150 for applying the envelope to the sound source sample recorded in the wave table according to the note playback duration information, and then outputting the note playback duration by converting the envelope to a frequency assigned to the plurality of notes.
The MIDI file, containing information about certain music, is stored in a storage medium and may include a score such as a plurality of notes, note playback duration information, and timbre. The note is information representing a minimum unit of a sound, and a plurality of notes represents a musical scale. The musical scale provides information about a note's tone (low or high), and seven notes (for example, C, D, E, etc.) are generally used in the musical scale. The note playback duration information provides information about a length of each note. The timbre represents a tone color and includes the note's unique characteristic that distinguishes two notes having the same tone, intensity, and length. For example, a ‘C’ note of the piano may be distinguished from a ‘C’ note of the violin according to their difference in characteristic timbres.
Further, the note playback duration means a length of playback time for each of the notes included in the MIDI file, and contains information about the note's playback length. For example, if a playback duration of a note ‘D’ is ⅛ second, the note ‘D’ from a sound source is played for ⅛ second.
Sound sources for each instrument and each note of the individual instruments are recorded in the wave table 130. Although, the scale is normally in a range of 1 through 128, there are limitations in recording all sound sources for all of the notes in the wave table 130. Accordingly, only a number of sound source samples are recorded for representative several notes in the wave table 130.
The envelope generator 140 generates an envelope which determines levels of a volume and a pitch according to envelope information preset by a user or in the MIDI file, and controls the volume or the pitch of the sound source samples played in response to the notes included in the MIDI file. Therefore, the envelope has a great influence on quality of the sound source sample played, and may use considerable resources of a central processing unit (CPU).
The envelope may be an envelope for volume or an envelope for pitch. The envelope for volume may be classified into four sections including an attack, a decay, a sustain, and a release.
Since those four sections for the sound source's volume are included in volume section information, they are used in synthesizing a sound.
The frequency converter 150 reads a sound source sample for each note from the wave table 130 if a playback duration for a note is inputted, applies an envelope generated from the envelope generator 140 to the read sound source sample, and outputs the sound source sample by converting the envelope to a frequency assigned to the note. An oscillator may be used as a frequency converter 150.
For example, if the sound source sample recorded in the wave table 130 was sampled with 20 KHz and a note of music is sampled with 40 KHz, the frequency converter 150 converts the 20 KHz sound source sample into a 40 KHz sound source sample to output the 40 KHz sound source sample.
Further, if the sound source sample for each note is not recorded in the wave table 130, a representative sound source sample for each note is read from the wave table 130, and the frequency of the read sound source sample is converted into a frequency of a sound source sample that corresponds to each note. If a sound source sample for a certain note is recorded in the wave table 130, the corresponding sound source sample can be read and outputted from the wave table 130 without any frequency conversion.
The above-described process is performed repeatedly whenever the note playback duration information for each note is inputted until the playback of the MIDI is terminated.
However, the conventional MIDI player sequentially applies the envelope to the sound source sample and converts the envelope to the frequency that corresponds to each note. Accordingly, a system requires a considerable amount of operations and consumes considerable CPU resources. Further, the MIDI file should be played and outputted in real time. However, since the frequency conversion is performed for each note as described above, music might not be played in real time.
Consequently, since the conventional MIDI player consumes considerable CPU resources, it is difficult to produce rich sound quality without using a CPU capable of high performance. Therefore, a technology capable of guaranteeing a sound quality level good enough for a user to hear, while using less CPU resources is desired.